﻿using System.Windows.Controls;
using JurnalPembelian.ViewModels;
using Lib.Helper;
using WcfService1.DTO;

namespace JurnalPembelian
{
    public partial class Index : Page
    {

        public JurnalPembelianWrapViewModel WrapViewModel
        {
            get
            {
                return this.Resources["POW"] as JurnalPembelianWrapViewModel;
            }
        }

        public JurnalPembelianViewModel ViewModel
        {
            get
            {
                return this.DataContext as JurnalPembelianViewModel;
            }
        }

        public Index()
        {
            InitializeComponent();
            JurnalPembelianViewModel.OnSearchCompleted = (x) =>
            {
                this.DataContext = (JurnalPembelianViewModel)x;
            };

            EventAggregator.RegisterMessage("ShowSearchJurnalPembelian", (x, y) =>
            {
                Search search = new Search();
                search.Show();
            });
        }

        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var pi = (sender as Button).DataContext as JurnalPembelianDTO;
            //MyButton button = new MyButton(GlobalVar.ReportUrl + "PI.aspx?no=" + HttpUtility.UrlEncode(pi.PINo));
            //button.ClickMe();
        }


    }
}


